location /shop {
    #需要代理的地址
    proxy_pass  http://fast.constqr.cn/shop;
}
location /shop {
    root /www/sites/fastmm.constqr.cn/index/fast-admin/public;
    fastcgi_pass 127.0.0.1:9002; # PHP-FPM 监听的地址
    fastcgi_index  index.php;

    try_files $uri $uri/ /index.php$is_args$args ;
    
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root/index.php;
    
    # 传递 PATH_INFO 用于路由解析
    fastcgi_param PATH_INFO $fastcgi_path_info;
}

location /shop {
    proxy_pass http://fastm.constqr.cn/shop;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    proxy_connect_timeout 60s;
    proxy_read_timeout 60s;
    proxy_send_timeout 60s;
}

server {
    listen 80 ; 
    server_name shopm.constqr.cn; 
    index index.php index.html index.htm default.php default.htm default.html; 
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Host $server_name; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection $http_connection; 
    access_log /www/sites/shopm.constqr.cn/log/access.log main; 
    error_log /www/sites/shopm.constqr.cn/log/error.log; 
    location ^~ /.well-known/acme-challenge {
        allow all; 
        root /usr/share/nginx/html; 
    }
    
    location /shop {
        fastcgi_pass 127.0.0.1:9002; # PHP-FPM 监听的地址
        
        fastcgi_param X-Requested-With XMLHttpRequest;
        fastcgi_param Accept application/json ;
        fastcgi_param Content-Type application/json ;
    }
    
    root /www/sites/shopm.constqr.cn/index/dist; 
    error_page 404 /404.html; 
    add_header Strict-Transport-Security "max-age=31536000"; 
}

server {
    listen 80 ; 
    server_name shopm.constqr.cn; 
    index index.php index.html index.htm default.php default.htm default.html; 
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Host $server_name; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection $http_connection; 
    access_log /www/sites/shopm.constqr.cn/log/access.log main; 
    error_log /www/sites/shopm.constqr.cn/log/error.log; 
    location ^~ /.well-known/acme-challenge {
        allow all; 
        root /usr/share/nginx/html; 
    }
    root /www/sites/shopm.constqr.cn/index/dist; 

    location / {
          #站点根目录，即网页文件存放的根目录, 默认主页目录在nginx安装目录的html子目录。 
        root   /www/sites/shopm.constqr.cn/index/dist;     

        #目录内的默认打开文件,如果没有匹配到index.html,则搜索index.htm,依次类推
        index  index.html index.htm;    

        #解决页面刷新404问题
        try_files $uri $uri/ /index.html;  
    }
    
    location /shop {
        rewrite  ^.+shop/?(.*)$ /$1 break;
        
       #需要代理的地址
        proxy_pass  http://fastmm.constqr.cn/shop;
    }
    
    error_page 404 /404.html; 
}

server
{
    listen 80;
    server_name shopm.constqr.cn;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/sites/shopm.constqr.cn/index/dist;
    #CERT-APPLY-CHECK--START
    # 用于SSL证书申请时的文件验证相关配置 -- 请勿删除
    # include /www/sites/shopm.constqr.cn/index/dist;
    # CERT-APPLY-CHECK--END

    #SSL-START SSL相关配置，请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    #SSL-END

    #ERROR-PAGE-START  错误页配置，可以注释、删除或修改
    error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END

    #PHP-INFO-START  PHP引用配置，可以注释或修改
    include enable-php-74.conf;
    #PHP-INFO-END

    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/sites/shopm.constqr.cn/rewrite/shopm.constqr.cn;
    #REWRITE-END

    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }

    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }

    #禁止在证书验证目录放入敏感文件
    if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
        return 403;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log /dev/null;
        access_log /dev/null;
    }

    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log /dev/null;
        access_log /dev/null;
    }
    
    location /shop {
      proxy_pass  https://fastmm.constqr.cn/shop;
    }

    
    access_log  /www/wwwlogs/shopm.constqr.cn.log;
    error_log  /www/wwwlogs/shopm.constqr.cn.error.log;
}